@import 'base/variables';
@import 'base/font';
@import 'base/mixins';
@import 'base/bs';
@import 'base/animation';
@import 'controls';
@import 'stage';
@import 'kc-toggle';

.form-wrap {
  position: relative;

  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

.cb-wrap,
.stage-wrap {
  vertical-align: top;
}

.stage-wrap h4 {
  margin-top: 0;
  color: $grey;
}

.form-elements {
  input {
    &.error {
      border: 1px solid $error;
    }

    &.fld-maxlength {
      width: 10%;
    }

    &.field-error {
      background: $off-white;
      border: 1px solid $input-border-color;
    }
  }

  label {
    em {
      display: block;
      font-weight: 400;
      font-size: .75em;
    }

    &.maxlength-label {
      line-height: 1em;
    }
  }

  .available-roles {
    display: none;
    padding: 10px;
    margin: 10px 0;
    background: darken($white, 10%);
    box-shadow: inset 0 0 2px 0 $grey-light-30;

    @include breakpoint('phone-lrg') {
      margin-left: 0;
    }


    label {
      font-weight: 400;
      width: auto;
      float: none;
      display: inline;
    }

    input {
      display: inline;
      top: auto;
    }
  }
}

.form-elements,
.form-group,
.multi-row span,
textarea {
  display: block;
}

.form-elements::after,
.form-group::after {
  content: '.';
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

.form-elements .field-options div:hover,
.frmb .legend,
.frmb .prev-holder {
  cursor: move;
}

// tooltips
.frmb-tt {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid darken($grey, 25%);
  background-color: $grey;
  border-radius: 5px;
  padding: 5px;
  color: $white;
  z-index: 20;
  text-align: left;
  font-size: 12px;
  pointer-events: none;

  &::before {
    border-color: darken($grey, 25%) transparent;
    bottom: -11px;
  }

  &::before,
  &::after {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 10px 10px 0;
    border-color: $grey transparent;
    display: block;
    width: 0;
    z-index: 1;
    margin-left: -10px;
    bottom: -10px;
    left: 20px;
  }

  a {
    text-decoration: underline;
    color: $white;
  }
}

.frmb li {
  &:hover,
  .fb-mobile & {
    .del-button,
    .toggle-form {
      opacity: 1;
    }
  }
}

.fresh .frmb .legend .element-info {
  display: inline-block;
  visibility: visible;
  line-height: 12px;
  margin-left: 6px;
}

.frmb-xml .ui-dialog-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 12px;
  padding: 0 30px;
  margin-top: 0;
}

.toggle-form {
  margin-left: 5px;
  opacity: 0;

  &:hover {
    border-color: lighten($grey, 40%);
  }

  &::before {
    margin: 0;
  }
}

.formb-field-vars .copy-var {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: $grey-light-30;
  text-indent: -9999px;
}

.ui-button {
  .ui-button-text {
    line-height: 0;
  }
}

.form-builder-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: $overlay-color;
  display: none;
  z-index: 10;

  &.visible {
    display: block;
  }
}

.form-builder-dialog {
  position: absolute;
  border-radius: 5px;
  background: $white;
  z-index: 20;
  transform: translate(-50%, -50%);
  top: 0;
  left: 0;
  padding: 10px;
  box-shadow: 0 3px 10px $black;
  min-width: 166px;

  h3 {
    margin-top: 0;
  }

  &.data-dialog {
    width: 65%;
    background-color: $dirt-gray;

    pre {
      background: none;
      border: 0 none;
      box-shadow: none;
      margin: 0;
      color: darken($white, 5%);
    }
  }

  &.positioned {
    transform: translate(-50%, -100%);

    .button-wrap {
      &::before {
        content: '';
        width: 0;
        height: 0;
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-top: 10px solid $white;
        position: absolute;
        left: 50%;
        top: 100%;
        transform: translate(-50%, 10px);
      }
    }
  }

  .button-wrap {
    position: relative;
    margin-top: 10px;
    text-align: right;
    clear: both;

    .btn {
      margin-left: 10px;
    }
  }
}
